/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author tank
 */


import java.util.Scanner;
public class task2
{
public static void main(String args[])
 {
int X;
int Y;
boolean isXValidInput = false;
boolean isYValidInput = false;
System.out.println("Enter a value for X (1 to 9 allowed):");
do
{
Scanner inputX= new Scanner(System.in);
    System.out.println("Enter a number:");
    X = inputX.nextInt();
    if(X<2 || X>9)
    {
    System.out.println("Not a valid input!");
    continue;
    }
     if(2<X && X<9)
     {
      isXValidInput = true;
     }

}while(!isXValidInput);
System.out.println("Enter a value for Y (1 to 9 allowed):");
do
{
Scanner inputY= new Scanner(System.in);
    System.out.println("Enter a number:");
    Y = inputY.nextInt();
    if(Y<2 || Y>9)
    {
    System.out.println("Not a valid input!");
    continue;
      }
     if(2<Y && Y<9)
     {
      isYValidInput = true;
     }

}while(!isYValidInput);
int sum = X;
for (int i=0;i<Y-1;i++){
 sum = sum*X;

}
System.out.println(X +" to power of "+ Y +" equals "+ sum +"!");

    }}

